package main;

/**
 *
 * @author Ramunas
 */
import javax.swing.table.AbstractTableModel;

public class Memory extends AbstractTableModel{
    private final int MAX_COLUMNS = 16+1;
    private final int MAX_ROWS = 64+1;
    private String[][] memory = new String[MAX_ROWS][MAX_COLUMNS];
    
    public Memory(){
        int i;
        Integer temp;
        for(i = 1; i < MAX_COLUMNS; i++){
            temp = i-1;
            memory[0][i] = temp.toString();
        }
        for(i = 1; i < MAX_ROWS; i++){
            temp = i-1;
            memory[i][0] = temp.toString();
        }
    }
    
    public void setMemory(int row, int column, String data){
        memory[row+1][column+1] = data;
    }
    
    public String getMemory(int row, int column){
        return memory[row+1][column+1];
    }
    
    @Override
    public String getValueAt(int row, int column){
        return memory[row][column];
    }

    @Override
    public int getRowCount() {
        return MAX_ROWS;
    }

    @Override
    public int getColumnCount() {
        return MAX_COLUMNS;
    }
    
}
